<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta content="en" name="language">
	<title>magick</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link media="screen" href="../docutils-api.css" type="text/css" rel="stylesheet">

</head>

<body>

<div class="banner">
<img src="../images/gm-107x76.png" alt="GraphicMagick logo" width="107" height="76" />
<span class="title">GraphicsMagick</span>
<form action="http://www.google.com/search">
  <input type="hidden" name="domains" value="www.graphicsmagick.org" />
  <input type="hidden" name="sitesearch" value="www.graphicsmagick.org" />
<span class="nowrap"><input type="text" name="q" size="25" maxlength="255" />&nbsp;<input type="submit" name="sa" value="Search" /></span>
</form>
</div>


<div class="navmenu">
<ul>
  <li><a href="../index.html">Home</a></li>
  <li><a href="../project.html">Project</a></li>
  <li><a href="../download.html">Download</a></li>
  <li><a href="../README.html">Install</a></li>
  <li><a href="../Hg.html">Source</a></li>
  <li><a href="../NEWS.html">News</a> </li>
  <li><a href="../utilities.html">Utilities</a></li>
  <li><a href="../programming.html">Programming</a></li>
  <li><a href="../reference.html">Reference</a></li>
</ul>
</div>

<main id="magick">
<h1 class="title">magick</h1>
<p class="subtitle" id="image-format-support-interfaces">Image format support interfaces</p>
<div class="contents topic" id="contents">
<p class="topic-title">Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#destroymagick" id="id31">DestroyMagick</a></p></li>
<li><p><a class="reference internal" href="#destroymagickinfo" id="id32">DestroyMagickInfo</a></p></li>
<li><p><a class="reference internal" href="#destroymagickinfolist" id="id33">DestroyMagickInfoList</a></p></li>
<li><p><a class="reference internal" href="#getimagemagick" id="id34">GetImageMagick</a></p></li>
<li><p><a class="reference internal" href="#getmagickinfo" id="id35">GetMagickInfo</a></p></li>
<li><p><a class="reference internal" href="#getmagickinfoarray" id="id36">GetMagickInfoArray</a></p></li>
<li><p><a class="reference internal" href="#initializemagick" id="id37">InitializeMagick</a></p></li>
<li><p><a class="reference internal" href="#initializemagickex" id="id38">InitializeMagickEx</a></p></li>
<li><p><a class="reference internal" href="#ismagickconflict" id="id39">IsMagickConflict</a></p></li>
<li><p><a class="reference internal" href="#listmagickinfo" id="id40">ListMagickInfo</a></p></li>
<li><p><a class="reference internal" href="#listmodulemap" id="id41">ListModuleMap</a></p></li>
<li><p><a class="reference internal" href="#magicktomime" id="id42">MagickToMime</a></p></li>
<li><p><a class="reference internal" href="#registermagickinfo" id="id43">RegisterMagickInfo</a></p></li>
<li><p><a class="reference internal" href="#panicdestroymagick" id="id44">PanicDestroyMagick</a></p></li>
<li><p><a class="reference internal" href="#setmagickinfo" id="id45">SetMagickInfo</a></p></li>
<li><p><a class="reference internal" href="#unregistermagickinfo" id="id46">UnregisterMagickInfo</a></p></li>
</ul>
</div>
<section id="destroymagick">
<h1><a class="toc-backref" href="#id31">DestroyMagick</a></h1>
<section id="synopsis">
<h2>Synopsis</h2>
<pre class="literal-block">DestroyMagick( void );</pre>
</section>
<section id="description">
<h2>Description</h2>
<p>DestroyMagick() destroys the GraphicsMagick environment, releasing all
allocated semaphores, memory, and temporary files.  This function
should be invoked in the primary (original) thread of the application's
process while shutting down, and only after any threads which might be
using GraphicsMagick functions have terminated.  Since GraphicsMagick
may use threads internally via OpenMP, it is also necessary for any
function calls into GraphicsMagick to have already returned so that
OpenMP worker threads are quiesced and won't be accessing any semaphores
or data structures which are destroyed by this function.</p>
<p>The OpenMP implementation (if present) starts/stops any OpenMP worker
threads and allocates/frees OpenMP resources using its own algorithms.
This means that OpenMP worker threads and OpenMP resources are likely
to remain allocated after DestroyMagick() returns.  Since OpenMP 5.0,
invoking omp_pause_resource_all(omp_pause_hard) will assure that any
resources allocated by OpenMP (threads, thread-specific memory, etc.)
are freed, and this may be called after DestroyMagick() has returned.</p>
<p>The format of the DestroyMagick function is:</p>
<pre class="literal-block">DestroyMagick( void );</pre>
</section>
</section>
<section id="destroymagickinfo">
<h1><a class="toc-backref" href="#id32">DestroyMagickInfo</a></h1>
<section id="id1">
<h2>Synopsis</h2>
<pre class="literal-block">void DestroyMagickInfo( <a class="reference external" href="../api/types.html#magickinfo">MagickInfo</a> ** magick_info );</pre>
</section>
<section id="id2">
<h2>Description</h2>
<p>DestroyMagickInfo() destroys a MagickInfo structure.</p>
<p>The format of the DestroyMagickInfoList method is:</p>
<pre class="literal-block">void DestroyMagickInfo( <a class="reference external" href="../api/types.html#magickinfo">MagickInfo</a> ** magick_info );</pre>
</section>
</section>
<section id="destroymagickinfolist">
<h1><a class="toc-backref" href="#id33">DestroyMagickInfoList</a></h1>
<section id="id3">
<h2>Synopsis</h2>
<pre class="literal-block">void DestroyMagickInfoList( void );</pre>
</section>
<section id="id4">
<h2>Description</h2>
<p>DestroyMagickInfo() deallocates memory associated with the MagickInfo list.</p>
<p>The format of the DestroyMagickInfoList method is:</p>
<pre class="literal-block">void DestroyMagickInfoList( void );</pre>
</section>
</section>
<section id="getimagemagick">
<h1><a class="toc-backref" href="#id34">GetImageMagick</a></h1>
<section id="id5">
<h2>Synopsis</h2>
<pre class="literal-block">const char *GetImageMagick( const unsigned char *magick, const size_t length );</pre>
</section>
<section id="id6">
<h2>Description</h2>
<p>GetImageMagick() searches for an image format that matches the specified
magick string.  If one is found the name is returned otherwise NULL.</p>
<p>The format of the GetImageMagick method is:</p>
<pre class="literal-block">const char *GetImageMagick( const unsigned char *magick, const size_t length );</pre>
<dl class="simple">
<dt>magick:</dt>
<dd><p>The image format we are searching for.</p>
</dd>
<dt>length:</dt>
<dd><p>The length of the binary string.</p>
</dd>
</dl>
</section>
</section>
<section id="getmagickinfo">
<h1><a class="toc-backref" href="#id35">GetMagickInfo</a></h1>
<section id="id7">
<h2>Synopsis</h2>
<pre class="literal-block">const <a class="reference external" href="../api/types.html#magickinfo">MagickInfo</a> *GetMagickInfo( const char *name, <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="id8">
<h2>Description</h2>
<p>GetMagickInfo() returns a pointer MagickInfo structure that matches
the specified name.  If name is NULL, the head of the image format list
is returned. It is not safe to traverse the list by using the previous and
next pointers in the MagickInfo structure since the list contents or order
may be altered while the list is being traversed. If the list must be
traversed, access it via the GetMagickInfoArray function instead.</p>
<p>If GraphicsMagick has not been initialized via InitializeMagick()
then this function will not work.</p>
<p>The format of the GetMagickInfo method is:</p>
<pre class="literal-block">const <a class="reference external" href="../api/types.html#magickinfo">MagickInfo</a> *GetMagickInfo( const char *name, <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<p>A description of each parameter follows:</p>
<dl class="simple">
<dt>name:</dt>
<dd><p>The image format we are looking for.</p>
</dd>
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
<section id="getmagickinfoarray">
<h1><a class="toc-backref" href="#id36">GetMagickInfoArray</a></h1>
<section id="id9">
<h2>Synopsis</h2>
<pre class="literal-block"><a class="reference external" href="../api/types.html#magickinfo">MagickInfo</a> ** GetMagickInfoArray( <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="id10">
<h2>Description</h2>
<p>GetMagickInfoArray() returns a sorted null-terminated array of MagickInfo
pointers corresponding to the available format registrations. If necessarly
all modules are loaded in order to return a complete list. This function
should be used to access the entire list rather than GetMagickInfo since
the list returned by GetMagickInfo may be re-ordered every time it is
invoked. Once the returned array is no longer needed, the allocated array
should be deallocated. Do not attempt to deallocate the MagickInfo
structures based on pointers in the array!</p>
<p>The format of the GetMagickList method is:</p>
<pre class="literal-block"><a class="reference external" href="../api/types.html#magickinfo">MagickInfo</a> ** GetMagickInfoArray( <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<p>A description of each parameter follows:</p>
<dl class="simple">
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
<section id="initializemagick">
<h1><a class="toc-backref" href="#id37">InitializeMagick</a></h1>
<section id="id11">
<h2>Synopsis</h2>
<pre class="literal-block">InitializeMagick( const char *path );</pre>
</section>
<section id="id12">
<h2>Description</h2>
<p>InitializeMagick() initializes the GraphicsMagick environment.</p>
<p>InitializeMagick() or InitializeMagickEx() MUST be invoked by the using
program before making use of GraphicsMagick functions or else the library
will be unusable and any usage is likely to cause a crash.</p>
<p>This function should be invoked in the primary (original) thread of the
application's process, and before starting any OpenMP threads, as part
of program initialization.</p>
<p>If alternate memory allocations are provided via MagickAllocFunctions()
then that function should be invoked before InitializeMagickEx() since
the memory allocation functions need to be consistent.</p>
<p>The format of the InitializeMagick function is:</p>
<pre class="literal-block">InitializeMagick( const char *path );</pre>
<p>A description of each parameter follows:</p>
<dl class="simple">
<dt>path:</dt>
<dd><p>The execution path of the current GraphicsMagick client (or NULL)</p>
</dd>
</dl>
</section>
</section>
<section id="initializemagickex">
<h1><a class="toc-backref" href="#id38">InitializeMagickEx</a></h1>
<section id="id13">
<h2>Synopsis</h2>
<pre class="literal-block">MagickPassFail InitializeMagickEx( const char *path, unsigned int options,
                                   <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="id14">
<h2>Description</h2>
<p>InitializeMagickEx() initializes the GraphicsMagick environment,
providing a bit more more control and visibility over initialization
than the original InitializeMagick().  Use DestroyMagick() to destroy
the GraphicsMagick environment when it is not longer needed.</p>
<p>InitializeMagick() or InitializeMagickEx() MUST be invoked by the using
program before making use of GraphicsMagick functions or else the library
will be unusable and any usage is likely to cause a crash.</p>
<p>This function should be invoked in the primary (original) thread of the
application's process, and before starting any OpenMP threads, as part
of program initialization.</p>
<p>If alternate memory allocations are provided via MagickAllocFunctions()
then that function should be invoked before InitializeMagickEx() since
the memory allocation functions need to be consistent.</p>
<p>Available options are:</p>
<p>o MAGICK_OPT_NO_SIGNAL_HANDER - Don't register ANSI/POSIX signal handlers</p>
<p>The format of the InitializeMagickEx function is:</p>
<pre class="literal-block">MagickPassFail InitializeMagickEx( const char *path, unsigned int options,
                                   <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<dl class="simple">
<dt>path:</dt>
<dd><p>The execution path of the current GraphicsMagick client (or NULL)</p>
</dd>
<dt>options:</dt>
<dd><p>Options bit flags tailoring initializations performed</p>
</dd>
<dt>exception:</dt>
<dd><p>Information about initialization failure is reported here.</p>
</dd>
</dl>
</section>
</section>
<section id="ismagickconflict">
<h1><a class="toc-backref" href="#id39">IsMagickConflict</a></h1>
<section id="id15">
<h2>Synopsis</h2>
<pre class="literal-block">MagickBool IsMagickConflict( const char *magick );</pre>
</section>
<section id="id16">
<h2>Description</h2>
<p>Method IsMagickConflict returns true if the image format conflicts with
a logical drive (.e.g. X:).</p>
<p>The format of the IsMagickConflict method is:</p>
<pre class="literal-block">MagickBool IsMagickConflict( const char *magick );</pre>
<p>A description of each parameter follows:</p>
<dl class="simple">
<dt>status:</dt>
<dd><p>Method IsMagickConflict returns true if the image format
conflicts with a logical drive.</p>
</dd>
<dt>magick:</dt>
<dd><p>Specifies the image format.</p>
</dd>
</dl>
</section>
</section>
<section id="listmagickinfo">
<h1><a class="toc-backref" href="#id40">ListMagickInfo</a></h1>
<section id="id17">
<h2>Synopsis</h2>
<pre class="literal-block">MagickPassFail ListMagickInfo( FILE *file, <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="id18">
<h2>Description</h2>
<p>ListMagickInfo() lists the image formats to a file.</p>
<p>The format of the ListMagickInfo method is:</p>
<pre class="literal-block">MagickPassFail ListMagickInfo( FILE *file, <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<p>A description of each parameter follows.</p>
<dl class="simple">
<dt>file:</dt>
<dd><p>A file handle.</p>
</dd>
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
<section id="listmodulemap">
<h1><a class="toc-backref" href="#id41">ListModuleMap</a></h1>
<section id="id19">
<h2>Synopsis</h2>
<pre class="literal-block">MagickPassFail ListModuleMap( FILE *file, <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="id20">
<h2>Description</h2>
<p>Method ListModuleMap lists the module alias info to a file in the XML
format used by modules.mgk. True is returned on success.</p>
<p>The format of the ListModuleMap method is:</p>
<pre class="literal-block">MagickPassFail ListModuleMap( FILE *file, <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<p>A description of each parameter follows.</p>
<dl class="simple">
<dt>file:</dt>
<dd><p>An pointer to a FILE.</p>
</dd>
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
<section id="magicktomime">
<h1><a class="toc-backref" href="#id42">MagickToMime</a></h1>
<section id="id21">
<h2>Synopsis</h2>
<pre class="literal-block">char *MagickToMime( const char *magick );</pre>
</section>
<section id="id22">
<h2>Description</h2>
<p>Method MagickToMime returns the officially registered (or de facto) MIME
media-type corresponding to a magick string.  If there is no registered
media-type, then the string &quot;image/x-magick&quot; (all lower case) is returned.
The returned string must be deallocated by the user.</p>
<p>The format of the MagickToMime method is:</p>
<pre class="literal-block">char *MagickToMime( const char *magick );</pre>
<p>A description of each parameter follows.</p>
<dl class="simple">
<dt>magick:</dt>
<dd><p>GraphicsMagick format specification &quot;magick&quot; tag.</p>
</dd>
</dl>
</section>
</section>
<section id="registermagickinfo">
<h1><a class="toc-backref" href="#id43">RegisterMagickInfo</a></h1>
<section id="id23">
<h2>Synopsis</h2>
<pre class="literal-block"><a class="reference external" href="../api/types.html#magickinfo">MagickInfo</a> *RegisterMagickInfo( <a class="reference external" href="../api/types.html#magickinfo">MagickInfo</a> *magick_info );</pre>
</section>
<section id="id24">
<h2>Description</h2>
<p>RegisterMagickInfo() adds attributes for a particular image format to the
list of supported formats.  The attributes include the image format name,
a method to read and/or write the format, whether the format supports the
saving of more than one frame to the same file or blob, whether the format
supports native in-memory I/O, and a brief description of the format.</p>
<p>The format of the RegisterMagickInfo method is:</p>
<pre class="literal-block"><a class="reference external" href="../api/types.html#magickinfo">MagickInfo</a> *RegisterMagickInfo( <a class="reference external" href="../api/types.html#magickinfo">MagickInfo</a> *magick_info );</pre>
<p>A description of each parameter follows:</p>
<dl class="simple">
<dt>magick_info:</dt>
<dd><p>The magick info.</p>
</dd>
</dl>
</section>
</section>
<section id="panicdestroymagick">
<h1><a class="toc-backref" href="#id44">PanicDestroyMagick</a></h1>
<section id="id25">
<h2>Synopsis</h2>
<pre class="literal-block">void PanicDestroyMagick( void );</pre>
</section>
<section id="id26">
<h2>Description</h2>
<p>PanicDestroyMagick() destroys only persistent allocations such as
temporary files.  Other allocations (e.g. semaphores and heap memory)
remain allocated.  This function is an alternative to DestroyMagick()
which is async-safe so it may be invoked from signal handers, and
may be invoked from thread context.  No semaphores are taken and no
additional heap memory is allocated by this function.  The program
must quit immediately after invoking this function.</p>
<p>The format of the PanicDestroyMagick function is:</p>
<pre class="literal-block">void PanicDestroyMagick( void );</pre>
</section>
</section>
<section id="setmagickinfo">
<h1><a class="toc-backref" href="#id45">SetMagickInfo</a></h1>
<section id="id27">
<h2>Synopsis</h2>
<pre class="literal-block"><a class="reference external" href="../api/types.html#magickinfo">MagickInfo</a> *SetMagickInfo( const char *name );</pre>
</section>
<section id="id28">
<h2>Description</h2>
<p>Method SetMagickInfo allocates a MagickInfo structure and initializes the
members to default values.</p>
<p>The format of the SetMagickInfo method is:</p>
<pre class="literal-block"><a class="reference external" href="../api/types.html#magickinfo">MagickInfo</a> *SetMagickInfo( const char *name );</pre>
<p>A description of each parameter follows:</p>
<dl class="simple">
<dt>magick_info:</dt>
<dd><p>Method SetMagickInfo returns the allocated and initialized
MagickInfo structure.</p>
</dd>
<dt>name:</dt>
<dd><p>a character string that represents the image format associated
with the MagickInfo structure.</p>
</dd>
</dl>
</section>
</section>
<section id="unregistermagickinfo">
<h1><a class="toc-backref" href="#id46">UnregisterMagickInfo</a></h1>
<section id="id29">
<h2>Synopsis</h2>
<pre class="literal-block">unsigned int UnregisterMagickInfo( const char *name );</pre>
</section>
<section id="id30">
<h2>Description</h2>
<p>Method UnregisterMagickInfo removes a name from the magick info list.  It
returns MagickFail if the name does not exist in the list otherwise
MagickPass.</p>
<p>The format of the UnregisterMagickInfo method is:</p>
<pre class="literal-block">unsigned int UnregisterMagickInfo( const char *name );</pre>
<p>A description of each parameter follows:</p>
<dl class="simple">
<dt>status:</dt>
<dd><p>Method UnregisterMagickInfo returns False if the name does not
exist in the list otherwise True.</p>
</dd>
<dt>name:</dt>
<dd><p>a character string that represents the image format we are
looking for.</p>
</dd>
</dl>
</section>
</section>
</main>


<hr class="docutils">
<div class="document">
    <p><a href="../Copyright.html">Copyright</a> © GraphicsMagick Group 2002-2025<!--SPONSOR_LOGO--></p>
</div>

</main>
</body>
</html>
